<template>
  <div>
    <el-card>
      <p>挂号订单</p>
      <el-table :data="tabledata">
        <el-table-column prop="reserveDate" label="就诊时间" />
        <el-table-column prop="hosname" label="医院" />
        <el-table-column prop="depname" label="科室" />
        <el-table-column prop="title" label="医生" />
        <el-table-column prop="amount" label="服务费" />
        <el-table-column prop="patientName" label="就诊人" />
        <el-table-column prop="address" label="订单状态">
            <template #default="scope">
                <span>{{scope.row.param.orderStatusString}}</span>
            </template>
        </el-table-column>
        <el-table-column prop="address" label="操作">
            <template #default="scope">
            <el-button type="primary" @click="info(scope.row.id)">详情</el-button>
            </template>
        </el-table-column>
      </el-table>
         <el-pagination layout="prev, pager, next" @current-change="handle" :total="total" />
    </el-card>
  </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import instance from "../assets/axios";
const tabledata = ref([]);
const total=ref(0)
const page = ref(1);
const size = ref(10);
const getdata = async () => {
  const res = await instance.get(
    `/api/order/orderInfo/auth/${page.value}/${size.value}`
  );
  console.log(res);
  total.value=res.data.total
  tabledata.value = res.data.records;
};
const handle=(e)=>{
    page.value=e;
    getdata()
}
const router=useRouter();
const info=(e)=>{
router.push({
     path: "/zhifu",
    query: {
      orderId: e,
    },
})
}
onMounted(() => {
  getdata();
});
</script>